package com.zemb.flxwear.ChatGPT;

import java.io.IOException;

//import okhttp3.MediaType;
//import okhttp3.OkHttpClient;
//import okhttp3.Request;
//import okhttp3.RequestBody;
//import okhttp3.Response;
//
//public class ChatGPTClient {
//    private static final String API_URL = "https://api.openai.com/v1/engine/davinci-codex/completions";
//    private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
//    private final OkHttpClient client;
//
//    private final String API_KEY ="kdfjapodigahdgamj10120jgrgd";
//
//    public ChatGPTClient() {
//        this.client = new OkHttpClient();
//    }
//
//    public String getResponse(String prompt) {
//        RequestBody requestBody = RequestBody.create(JSON, "{\"prompt\": \"" + prompt + "\",\"max_tokens\":50}");
//
//        Request request = new Request.Builder()
//                .header("Content-Type", "application/json")
//                .header("Authorization", "Bearer " + API_KEY)
//                .url(API_URL)
//                .post(requestBody)
//                .build();
//
//
//        try (Response response = client.newCall(request).execute()) {
//            if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
//
//            return response.body().string();
//        } catch (IOException e) {
//            e.printStackTrace();
//            return null;
//        }
//    }
//}